<%--
  Created by IntelliJ IDEA.
  User: 曦月丶
  Date: 2021/11/5
  Time: 20:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script src="/js/vue.js"></script>
<script src="/js/axios.min.js"></script>

<div id="app">

    用户名：<input type="text" placeholder="请输入用户名" v-model="user.name"><br>
    密码：<input type="password" placeholder="请输入密码" v-model="user.pwd"><br>
    响应的值：{{msg}}<br>
    <input type="button" value="点击" @click="ajax1()"><br>
    <input type="button" value="点击1" @click="ajax2()"><br>
    <input type="button" value="点击2" @click="ajax3()">

</div>

<script>
    new Vue({
     el:"#app",
     data: {
         user: {
             name: "",
             pwd: ""
     },
         msg:""
     },
        methods:{
            ajax1() {
                axios.get("/axioss",{params:this.user})
                    .then(resp=>{
                        console.log(resp.data);
                        this.msg=resp.data
                    });
            },
            ajax3() {
                axios.post("/axioss3",this.user)
                    .then(resp=>{
                        console.log(resp.data);
                        this.msg=resp.data;
                    });
            }
        }
    });
</script>

<hr>


</body>
</html>
